import {getAllDictTree, menuList, selectAllDict} from '../../assets/js/service.business';

export default {
    state: {
        dict: {},
        all_dict: {}
    },
    mutations: {
        set_dict: function (state, res) {
            state.dict = res;
        },
        set_all_dict: function (state, res) {
            state.all_dict = res;
        }
    },
    actions: {
        getAllDictTree: async function ({commit}, args) {
            let res = await getAllDictTree(args);
            if (res.code === 0) {
                commit('set_dict', res)
            } else {
                commit('set_dict', [])
            }
            return res;
        },
        selectAllDict: async function ({commit}, args) {
            let res = await selectAllDict(args);
            if (res.code === 0) {
                commit('set_all_dict', res)
            } else {
                commit('set_all_dict', [])
            }
            return res;
        }
    }
};
